package site;

import java.io.IOException;

import javax.ejb.EJB;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Servlet implementation class ListeArticleServlet
 */
public class ListeArticleServlet extends HttpServlet {
	private static final long serialVersionUID = 1L;
	
	public static int i = 0;

	@EJB
	ArticleManager am ;
       
    /**
     * @see HttpServlet#HttpServlet()
     */
    public ListeArticleServlet() {
        super();
        // TODO Auto-generated constructor stub
    }

	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		request.setAttribute("ident", am.listeIdentArticle());
    	request.setAttribute("Titre", am.listeTitre());
    	request.setAttribute("Date", am.listeDate());
    	request.setAttribute("Contenu", am.listeContenu());	    	
    	request.setAttribute("image", am.listeImage());
	request.getRequestDispatcher("listArticle.jsp").forward(request, response);
	}

	/**
	 * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
		doGet(request,response);
	}

}
